home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
C⁄C++
/
Xconq 7.0d37
/
source
/
mac
/
maccmd.c
< prev
next >
Wrap
Text File
|
1995-05-02
|
22KB
|
1,187 lines
/* Commands for the Mac interface to Xconq.
Copyright (C) 1992, 1993, 1994, 1995 Stanley T. Shebs.
Xconq is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version. See the file COPYING. */
#include "conq.h"
#include "print.h"
#include "macconq.h"
extern WindowPtr playersetupwin;
#undef DEF_CMD
#define DEF_CMD(letter,name,args,FN,help) extern void FN(void);
#include "cmd.def"
#include "maccmd.def"
extern int do_one_give(Unit *unit);
extern int do_one_take(Unit *unit);
extern int do_one_return(Unit *unit);
extern int do_one_detonate(Unit *unit);
extern int do_one_give_unit(Unit *unit);
static int do_one_delay(Unit *unit);
extern int do_one_detach(Unit *unit);
extern int do_one_disband(Unit *unit);
static int do_one_reserve(Unit *unit);
static int do_one_asleep(Unit *unit);
static int do_one_ai_control(Unit *unit);
extern int do_one_clear_plan(Unit *unit);
extern int do_one_dir_move(Unit *unit);
extern int do_one_dir_multiple_move(Unit *unit);
extern int do_one_set_name(Unit *unit);
static int do_one_add_terrain(Unit *unit);
static int do_one_remove_terrain(Unit *unit);
static void resign_the_game(int forced);
extern int forcedtoresign;
extern int modal_construction;
extern WindowPtr window_behind_construction;
extern Feature *featurelist;
#ifdef THINK_C
#include <profile.h>
#endif
extern int Profile;
#ifdef PROFILING
extern int _trace;
#endif
#define side_may_select(unit) (in_play(unit) && ((unit)->side == dside || dside->designer))
#define valid_selection(unit) (in_play(unit) && ((unit)->side == dside || dside->designer))
extern int gamestatesafe;
extern int interfacestatesafe;
extern char *cursavename;
/* Static (local) variables. */
static int tmpcmdarg;
static int tmprecurse;
static int tmpcmdx, tmpcmdy, tmpcmddir;
/* This is the actual key typed, for use if several keyboard commands
share a single function. */
static char tmpkey;
/* Prefixed numeric argument to commands. */
static int prefixarg;
static int tmpdir;
static int tmpargc;
static char **tmpargv;
/* This flag is set to prevent running an "other" command when already
executing an "other" command. */
static int doingother = FALSE;
typedef struct cmdtab {
char fchar; /* character to match against */
char *name; /* full name of command */
void (*fn)(void); /* pointer to command's function */
char *help; /* short documentation string */
} CmdTab;
#define C(c) ((c)-0x40)
#undef DEF_CMD
#define DEF_CMD(LETTER,NAME,args,FN,HELP) { LETTER, NAME, FN, HELP },
/* The generic command table. */
CmdTab commands[] = {
#include "maccmd.def"
#include "cmd.def"
{ 0, NULL, NULL, NULL }
};
/* The Mac-specific command table. */
CmdTab mac_commands[] = {
#include "maccmd.def"
{ 0, NULL, NULL, NULL }
};
/* Given a character, find a command for it and execute. */
void
do_keyboard_command(int key)
{
CmdTab *cmd;
void (*fn)(void);
DGprintf("Typed '%c' (0x%x)\n", key, key);
if (between('0', key, '9')) {
/* Add a decimal digit to the prefix argument. */
if (prefixarg < 0) prefixarg = 0;
prefixarg += prefixarg * 10 + (key - '0');
/* (should add some sort of feedback) */
} else {
/* Look through the generic command table. */
for (cmd = commands; cmd->name != NULL; ++cmd) {
if (key == cmd->fchar) {
if ((fn = cmd->fn) == NULL) {
run_warning("no command function for %s (0x%x)?", cmd->name, key);
return;
}
tmpkey = key;
(*fn)();
/* Reset the prefix argument. */
prefixarg = -1;
return;
}
}
}
}
void
execute_named_command(char *cmdstr)
{
char *cmdname = NULL;
CmdTab *cmd;
int i;
void (*fn)(void);
tmpargc = 0;
if (tmpargv == NULL)
tmpargv = (char **) xmalloc(2 * sizeof(char *));
if (strchr(cmdstr, ' ')) {
for (i = 0; cmdstr[i] != ' ' && cmdstr[i] != '\0'; ++i);
cmdname = cmdstr + i;
} else {
cmdname = cmdstr;
}
if (cmdname == NULL || *cmdname == '\0') return;
tmpargv[tmpargc++] = cmdname;
for (cmd = commands; cmd->name != NULL; ++cmd) {
if (strcmp(cmdname, cmd->name) == 0) {
if ((fn = cmd->fn) == NULL) {
run_warning("no command function for %s?", cmd->name);
return;
}
/* Use the command's char as the apparent key. */
tmpkey = cmd->fchar;
(*fn)();
/* Reset the prefix argument. */
prefixarg = -1;
return;
}
}
beep();
}
void
describe_commands(int arg, char *key, char *buf)
{
describe_command_table(arg, key, buf, commands);
/* (should split out Mac-specific commands??) */
}
void
describe_command_table(int arg, char *key, char *buf, CmdTab *cmdtab)
{
CmdTab *cmd;
strcat(buf, "Single-key commands:\n\n");
for (cmd = cmdtab; cmd->name != NULL; ++cmd) {
describe_command(cmd->fchar, cmd->name, cmd->help, TRUE, buf);
}
strcat(buf, "\nLong name commands:\n\n");
for (cmd = cmdtab; cmd->name != NULL; ++cmd) {
describe_command (cmd->fchar, cmd->name, cmd->help, FALSE, buf);
}
}
/* Start of alphabetized commands. */
void
do_add_player()
{
beep();
}
void
do_add_terrain()
{
int x, y, dir;
Point to;
Map *map;
if ((map = map_from_window(FrontWindow())) != NULL) {
GetMouse(&to);
if (m_nearest_boundary(map, to.h, to.v, &x, &y, &dir)) {
tmpcmdx = x; tmpcmdy = y; tmpcmddir = dir;
apply_to_all_selected(do_one_add_terrain, TRUE);
return;
}
}
beep();
}
static int
do_one_add_terrain(Unit *unit)
{
int u, t, dir;
u = unit->type;
for_all_terrain_types(t) {
if (ut_acp_to_add_terrain(u, t) > 0
&& unit->act
&& unit->act->acp >= ut_acp_to_add_terrain(u, t)) {
if (distance(tmpcmdx, tmpcmdy, unit->x, unit->y) <= ut_alter_range(u, t)) {
if (prep_add_terrain_action(unit, unit, tmpcmdx, tmpcmdy, tmpcmddir, t))
return TRUE;
} else {
dir = closest_dir(tmpcmdx - unit->x, tmpcmdy - unit->y);
if (prep_add_terrain_action(unit, unit, unit->x, unit->y, dir, t))
return TRUE;
}
}
}
return FALSE;
}
void
do_ai_side()
{
if (side_has_ai(dside)) {
set_side_ai(dside, NULL);
} else {
set_side_ai(dside, "mplayer");
}
}
void
do_attack()
{
do_attack_command();
}
void
do_auto()
{
do_ai_control_command();
}
int favored_type(Unit *unit);
void
do_build()
{
int i;
Map *map; List *list; UnitCloseup *closeup;
Unit *unit;
if ((map = map_from_window(FrontWindow())) != NULL) {
for (i = 0; i < map->numselections; ++i) {
if ((unit = map->selections[i]) != NULL) {
if (can_build(unit)) { /* and completers and researchers too? */
modal_construction = TRUE;
window_behind_construction = FrontWindow();
enable_construction();
select_unit_in_construction_window(unit);
select_type_in_construction_window(favored_type(unit));
return;
}
}
}
} else if ((list = list_from_window(FrontWindow())) != NULL) {
if ((unit = (Unit *) selected_unit_in_list(list)) != NULL) {
if (can_build(unit)) { /* and completers and researchers too? */
modal_construction = TRUE;
enable_construction();
select_unit_in_construction_window(unit);
select_type_in_construction_window(favored_type(unit));
return;
}
}
} else if ((closeup = unit_closeup_from_window(FrontWindow())) != NULL) {
if ((unit = closeup->unit) != NULL) {
if (can_build(unit)) { /* and completers and researchers too? */
modal_construction = TRUE;
enable_construction();
select_unit_in_construction_window(unit);
select_type_in_construction_window(favored_type(unit));
return;
}
}
}
}
/* (should be in kernel?) */
int
favored_type(Unit *unit)
{
int u;
if (unit == NULL)
return NONUTYPE;
if (unit->plan
&& unit->plan->tasks
&& unit->plan->tasks->type == TASK_BUILD)
return unit->plan->tasks->args[0];
for_all_unit_types(u) {
if (uu_acp_to_create(unit->type, u) > 0)
return u;
}
return NONUTYPE;
}
/* Create and/or bring up the construction planning window. */
void
enable_construction()
{
window_behind_construction = FrontWindow();
if (constructionwin == nil) {
create_construction_window();
}
if (constructionwin != nil) {
reinit_construction_lists();
ShowWindow(constructionwin);
SelectWindow(constructionwin);
}
}
int
do_one_clear_plan(Unit *unit)
{
if (unit->plan) {
set_unit_plan_type(dside, unit, PLAN_NONE);
return TRUE;
}
return FALSE;
}
void
do_clear_plan()
{
apply_to_all_selected(do_one_clear_plan, TRUE);
}
void
do_copying()
{
/* (should be a help node?) */
beep();
}
void
do_delay()
{
apply_to_all_selected(do_one_delay, TRUE);
}
int
do_one_delay(Unit *unit)
{
if (unit->plan) {
delay_unit(unit, TRUE);
return TRUE;
}
return FALSE;
}
void
do_detach()
{
apply_to_all_selected(do_one_detach, TRUE);
}
int
do_one_detach(Unit *unit)
{
if (!completed(unit)) {
return FALSE;
} else if (unit->act && unit->act->acp > 0) {
prep_transfer_part_action(unit, unit, unit->hp / 2, NULL);
return TRUE;
} else {
/* try to find a nearby unit to do it */
}
return FALSE;
}
void
do_detonate()
{
do_detonate_command();
}
/* Command all selected mobile units to move in a given direction. */
/* The function that gets called on each selected unit. */
int
do_one_dir_move(Unit *unit)
{
if (mobile(unit->type)) {
set_movedir_task(unit, tmpdir, 1);
return TRUE;
}
return FALSE;
}
/* The command function proper. */
void
do_dir()
{
char *rawdir;
Map *map;
if ((map = map_from_window(FrontWindow())) != NULL) {
rawdir = strchr(dirchars, tmpkey);
if (rawdir)
tmpdir = rawdir - dirchars;
else if (tmpkey == 'k')
tmpdir = (flip_coin() ? NORTHEAST : NORTHWEST);
else if (tmpkey == 'j')
tmpdir = (flip_coin() ? SOUTHEAST : SOUTHWEST);
else {
beep();
return;
}
apply_to_all_selected(do_one_dir_move, TRUE);
}
}
/* Command all selected mobile units to move in a given direction. */
/* The function that gets called on each selected unit. */
int
do_one_dir_multiple_move(Unit *unit)
{
if (mobile(unit->type)) {
set_movedir_task(unit, tmpdir, 9999);
return TRUE;
}
return FALSE;
}
/* The command function proper. */
void
do_dir_multiple()
{
char *rawdir;
Map *map;
if ((map = map_from_window(FrontWindow())) != NULL) {
rawdir = strchr(dirchars, tolower(tmpkey));
if (rawdir)
tmpdir = rawdir - dirchars;
else if (tmpkey == 'k')
tmpdir = (flip_coin() ? NORTHEAST : NORTHWEST);
else if (tmpkey == 'j')
tmpdir = (flip_coin() ? SOUTHEAST : SOUTHWEST);
else {
beep();
return;
}
apply_to_all_selected(do_one_dir_multiple_move, TRUE);
}
}
void
do_disband()
{
apply_to_all_selected(do_one_disband, TRUE);
}
int
do_one_disband(Unit *unit)
{
/* (should call a designer_disband routine) */
#ifdef DESIGNERS
if (dside->designer) {
kill_unit(unit, -1);
return TRUE;
} else
#endif /* DESIGNERS */
if (!completed(unit)) {
kill_unit(unit, H_UNIT_DISBANDED);
return TRUE;
} else if (unit->act && unit->act->acp > 0) {
prep_disband_action(unit, unit);
return TRUE;
} else {
/* try to find a nearby unit to do it */
}
return FALSE;
}
void
do_distance()
{
beep();
}
void
do_end_turn()
{
/* <return> is also interpreted by dialogs, so special-case this, depending
on which window was in front. */
if (FrontWindow() == constructionwin) {
Point pt;
extern ControlHandle constructbutton;
pt.h = (*constructbutton)->contrlRect.left + 8;
pt.v = (*constructbutton)->contrlRect.top + 8;
do_mouse_down_construction(pt, 0);
} else {
finish_turn(dside);
}
}
void
do_fire()
{
do_fire_command();
}
void
do_fire_into()
{
do_fire_into_command();
}
void
do_give()
{
/* (should use argument) */
apply_to_all_selected(do_one_give, TRUE);
}
void
do_give_unit()
{
int sn = 0;
Side *side;
side = side_n(sn);
apply_to_all_selected(do_one_give_unit, TRUE);
}
void
do_help()
{
help_dialog();
}
void
do_message()
{
message_dialog();
}
/* Dialog for the input of a textual message. */
/* (should add way to specify which sides to receive this) */
void
message_dialog()
{
short done = FALSE, ditem;
char *msg = NULL;
DialogPtr win;
short itemtype; Handle itemhandle; Rect itemrect;
win = GetNewDialog(dMessage, NULL, (DialogPtr) -1L);
ShowWindow(win);
while (!done) {
draw_default_button(win, diMessageOK);
SetCursor(&QD(arrow));
ModalDialog(NULL, &ditem);
switch (ditem) {
case diMessageOK:
GetDItem(win, diMessageText, &itemtype, &itemhandle, &itemrect);
msg = get_string_from_item(itemhandle);
/* Fall into next case. */
case diMessageCancel:
done = TRUE;
break;
}
}
/* Close down the dialog (*before* executing any command). */
DisposDialog(win);
/* Now send the message (if it wasn't cancelled) */
if (msg != NULL) {
send_message(dside, ALLSIDES, msg);
}
}
void
do_move_to()
{
beep();
}
int
do_one_set_name(Unit *unit)
{
return unit_rename_dialog(unit);
}
void
do_name()
{
apply_to_all_selected(do_one_set_name, TRUE);
}
void
do_other()
{
/* Don't allow recursion with this command. */
if (!doingother) {
doingother = TRUE;
command_dialog();
doingother = FALSE;
} else {
beep();
}
}
/* Dialog for the input of a textual command. */
void
command_dialog()
{
short done = FALSE, ditem;
char *cmd = NULL;
DialogPtr win;
short itemtype; Handle itemhandle; Rect itemrect;
win = GetNewDialog(dCommand, NULL, (DialogPtr) -1L);
ShowWindow(win);
while (!done) {
draw_default_button(win, diCommandOK);
SetCursor(&QD(arrow));
ModalDialog(NULL, &ditem);
switch (ditem) {
case diCommandOK:
GetDItem(win, diCommandText, &itemtype, &itemhandle, &itemrect);
cmd = get_string_from_item(itemhandle);
/* Fall into next case. */
case diCommandCancel:
done = TRUE;
break;
}
}
/* Close down the dialog (*before* executing any command). */
DisposDialog(win);
/* Now do the command (if it wasn't cancelled) */
if (cmd != NULL) {
execute_named_command(cmd);
}
}
void
do_print_view()
{
dump_ps_view(dside, NULL, "View PS");
}
void
do_produce()
{
beep();
}
void
do_quit()
{
quit_the_game();
}
static int allsumx, allsumy, unitcount;
static int
add_unit_position(Unit *unit)
{
allsumx += unit->x; allsumy += unit->y;
++unitcount;
return TRUE;
}
void
do_recenter()
{
int avgx, avgy;
Map *map;
map = map_from_window(FrontWindow());
if (map != NULL) {
allsumx = allsumy = 0;
unitcount = 0;
apply_to_all_selected(add_unit_position, FALSE);
if (unitcount == 0) {
beep();
return;
}
avgx = allsumx / unitcount; avgy = allsumy / unitcount;
set_focus(map, avgx, avgy);
}
}
void
set_focus(Map *map, int x, int y)
{
if (!inside_area(x, y))
return;
set_view_focus(map->vp, x, y);
m_center_on_focus(map);
set_map_scrollbars(map);
force_map_update(map);
}
/* Recalculate and redraw everything. */
void
do_refresh()
{
Map *map;
List *list;
UnitCloseup *closeup;
reset_coverage();
reset_all_views();
compute_all_feature_centroids();
/* Force updates to all open windows. */
for_all_maps(map) {
force_update(map->window);
}
for_all_lists(list) {
force_update(list->window);
}
for_all_unit_closeups(closeup) {
force_update(closeup->window);
}
if (gamewin != nil) {
force_update(gamewin);
}
if (historywin != nil) {
force_update(historywin);
}
if (constructionwin != nil) {
force_update(constructionwin);
}
if (helpwin != nil) {
force_update(helpwin);
}
}
void
do_remove_terrain()
{
int x, y, dir;
Point to;
Map *map;
if ((map = map_from_window(FrontWindow())) != NULL) {
GetMouse(&to);
if (m_nearest_boundary(map, to.h, to.v, &x, &y, &dir)) {
tmpcmdx = x; tmpcmdy = y; tmpcmddir = dir;
apply_to_all_selected(do_one_remove_terrain, TRUE);
return;
}
}
beep();
}
static int
do_one_remove_terrain(Unit *unit)
{
int u, t, dir;
u = unit->type;
for_all_terrain_types(t) {
if (ut_acp_to_remove_terrain(u, t) > 0
&& unit->act
&& unit->act->acp >= ut_acp_to_remove_terrain(u, t)) {
if (distance(tmpcmdx, tmpcmdy, unit->x, unit->y) <= ut_alter_range(u, t)) {
if (prep_remove_terrain_action(unit, unit, tmpcmdx, tmpcmdy, tmpcmddir, t))
return TRUE;
} else {
dir = closest_dir(tmpcmdx - unit->x, tmpcmdy - unit->y);
if (prep_remove_terrain_action(unit, unit, unit->x, unit->y, dir, t))
return TRUE;
}
}
}
return FALSE;
}
static int
do_one_reserve(Unit *unit)
{
set_unit_reserve(dside, unit, tmpcmdarg, tmprecurse);
return TRUE;
}
void
do_reserve_command(int value, int recurse)
{
tmpcmdarg = value;
tmprecurse = recurse;
apply_to_all_selected(do_one_reserve, TRUE);
}
void
do_reserve()
{
do_reserve_command(TRUE, FALSE);
}
static int
do_one_return(Unit *unit)
{
if (1 /* has a place to return to */) {
set_resupply_task(unit);
return TRUE;
}
return FALSE;
}
void
do_return()
{
apply_to_all_selected(do_one_return, TRUE);
}
void
do_save()
{
save_the_game(FALSE, FALSE);
}
void
do_set_formation()
{
int i, numcould = 0, numnot = 0;
Point lead;
Map *map;
Unit *follower, *leader;
if ((map = map_from_window(FrontWindow())) != NULL) {
GetMouse(&lead);
m_nearest_unit(map, lead.h, lead.v, &leader);
if (leader != NULL) {
for (i = 0; i < map->numselections; ++i) {
if ((follower = map->selections[i]) != NULL && valid_selection(follower)) {
if (leader != follower
&& leader->side == follower->side
) {
set_formation(follower, leader, follower->x - leader->x, follower->y - leader->y, 1, 1);
++numcould;
} else {
++numnot;
}
}
}
} else {
/* (should beep?) */
}
}
/* If nobody could do the action, beep once. */
if (numcould == 0 && numnot > 0) {
beep();
}
}
static int
do_one_asleep(Unit *unit)
{
set_unit_asleep(dside, unit, tmpcmdarg, tmprecurse);
return TRUE;
}
void
do_sleep_command(int value, int recurse)
{
tmpcmdarg = value;
tmprecurse = recurse;
apply_to_all_selected(do_one_asleep, TRUE);
}
void
do_sleep()
{
do_sleep_command(TRUE, FALSE);
}
void
do_survey()
{
Map *map;
if ((map = map_from_window(FrontWindow())) != NULL) {
toggle_survey(map);
}
}
void
do_take()
{
/* (should use argument) */
apply_to_all_selected(do_one_take, TRUE);
}
void
do_take_unit()
{
beep();
}
void
do_version()
{
do_about_box();
}
void
do_wake()
{
do_sleep_command(FALSE, FALSE);
do_reserve_command(FALSE, FALSE);
}
void
do_wake_all()
{
do_sleep_command(FALSE, TRUE);
do_reserve_command(FALSE, TRUE);
}
void
do_warranty()
{
/* (should be a help node?) */
beep();
}
#ifdef DESIGNERS
/* Toggle the designer mode. */
void
do_design()
{
if (!dside->designer) {
enable_designing(FALSE);
} else {
disable_designing();
}
}
#endif
#ifdef DEBUGGING
void
do_debug()
{
toggle_debugging(&Debug);
}
void
do_debugg()
{
toggle_debugging(&DebugG);
}
void
do_debugm()
{
toggle_debugging(&DebugM);
}
void
do_profile()
{
toggle_debugging(&Profile);
}
void
do_trace()
{
toggle_debugging(&Profile);
#ifdef PROFILING
_trace = 1;
#endif
}
#endif
/* End of alphabetized commands. */
/* Mac-specific command functions. */
void
do_force_global_replan()
{
force_global_replan(dside);
}
void
do_escape()
{
map_modal = NO_MODAL;
}
void
do_set_map_angle()
{
int angle;
Map *map;
extern int vertexagg;
map = map_from_window(FrontWindow());
if (map != NULL) {
angle = map->vp->angle;
if (angle == 90)
angle = 30;
else if (angle == 30)
angle = 15;
else
angle = 90;
vertexagg = (prefixarg < 1 ? 1 : prefixarg);
set_view_angle(map->vp, angle);
force_map_update(map);
}
}
#ifdef DEBUGGING
/* Junk associated with debug output. */
/* This is all fairly elaborate because we need to be able to collect
detailed logs of AI activity over different periods of time, and just
dumping to stdout doesn't work in a window system. */
#ifdef USE_CONSOLE
#ifdef THINK_C
#include <console.h>
#endif
#endif
extern FILE *pfp;
FILE *ffp = NULL;
int firstdebug = TRUE;
void
update_debugging()
{
if (Debug || DebugG || DebugM || Profile) {
/* Always close the file if open, forces to desirable state. */
if (ffp != NULL) {
fclose(ffp);
ffp = NULL;
}
/* Reopen the file. */
if (ffp == NULL) {
ffp = fopen("Xconq.DebugOut", "a");
}
if (ffp != NULL) {
if (Debug)
dfp = ffp;
if (DebugG)
dgfp = ffp;
if (DebugM)
dmfp = ffp;
if (Profile)
pfp = ffp;
}
}
}
/* Debug output goes to a file. */
void
toggle_debugging(int *flagp)
{
#ifdef PROFILING
extern int _profile;
#endif
/* Always close the file if open, forces to desirable state. */
if (ffp != NULL) {
fclose(ffp);
ffp = NULL;
}
/* Flip the state of the debugging flag, if supplied. */
if (flagp != NULL) {
*flagp = ! *flagp;
}
/* (Re-)open the debugging transcript file. */
if (ffp == NULL) {
ffp = fopen("Xconq.DebugOut", (firstdebug ? "w" : "a"));
firstdebug = FALSE;
}
if (flagp != NULL) {
/* Indicate which flags are now on. */
fprintf(ffp, "\n\n*********** %s %s %s %s **********\n\n",
(Debug ? "Debug" : ""), (DebugM ? "DebugM" : ""),
(DebugG ? "DebugG" : ""), (Profile ? "Profile" : ""));
/* Indicate this in a window also. */
draw_game();
}
/* Set specific debug file pointers to be the same as the
pointer to the file. */
if (ffp != NULL) {
if (Debug) dfp = ffp;
if (DebugG) dgfp = ffp;
if (DebugM) dmfp = ffp;
if (Profile) pfp = ffp;
}
#ifdef PROFILING
#ifdef THINK_C
if (Profile && !_profile) {
InitProfile(1000, 100);
}
if (!Profile && _profile) {
EndProfile();
}
#endif
#endif
/* If all debugging flags have been turned off, close the file too. */
if (!Debug && !DebugG && !DebugM && !Profile) {
if (ffp != NULL) {
fclose(ffp);
ffp = NULL;
}
}
}
#endif /* DEBUGGING */